<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

</head>
<body>
<div>
    <textarea id="tfff" rows="10" cols="10"
              placeholder="请输入你的评价"></textarea>
    <input type="button" id="fbtn" value="发表">
</div>
<div id="evaluate"></div>

<script>
    window.onload = function () {
        var tff = document.getElementById('tfff');
        var fbtn = document.getElementById('fbtn');
        var evaluate = document.getElementById('evaluate');
        fbtn.onclick = function () {
            if (tff.value.length == 0) {
                alert("请输入内容呀");
                tff.focus();
                return;
            }
            var s_p = document.createElement("p");
            s_p.innerHTML = tff.value + "<span>删除</span>";
            evaluate.appendChild(s_p);
            tff.value = "";
        };
        //父元素,子元素操作删除事件
        evaluate.addEventListener('click', function (e) {
            // var span = document.getElementsByTagName("span")[0];
            // span.setAttribute('class', 'del');
            // var del = document.getElementsByClassName('del')[0];
            // del.parentNode.parentNode.removeChild(del.parentNode);
            e = e || window.event;
            var target=e.target||e.srcElement;
            evaluate.removeChild(target.parentNode);
        })
    }

</script>
</body>
</html>